package com.itheima;

import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.util.pattern.PathPatternParser;

/*****
 * @Author: http://www.itheima.com
 * @Description: com.itheima.GatewayWebApplication
 ****/
@SpringBootApplication
public class GatewayWebApplication {

    public static void main(String[] args) {
        ApplicationContext act = SpringApplication.run(GatewayWebApplication.class, args);


        //创建一个数组，用于存储已经存在的地址
        RedissonClient redissonClient = act.getBean(RedissonClient.class);
        RBloomFilter<String> filters = redissonClient.getBloomFilter("BloomFilterArray");
        //初始化一下
        filters.tryInit(10000L,0.001);

        //统计系统有哪些地址
        for (int i = 0; i <10000 ; i++) {
            filters.add("/red/packet/"+(i+1));
        }

        //添加存在的
        filters.add("/red/packet/wangwu");
    }
}
